import Vue from 'vue'
import Vuex from 'vuex'
import avatar from '@/assets/img/avatar.jpg'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    avatarUrl: avatar,  //头像
    showAvatarDialog: false, //显示 修改头像 框
    navigationIndex: 0 //navigation中激活的项目
  },
  mutations: {
    // toggleAvatarDialog(state){
    //   state.showAvatarDialog = !state.showAvatarDialog;
    // },
    openAvatarDialog(state){
      state.showAvatarDialog = true;
    },
    closeAvatarDialog(state){
      state.showAvatarDialog = false;
    },
    changeNavigationIndex(state,index){  //修改navigation中的index
      state.navigationIndex = index;
    },
    changeAvatar(state,url){  //修改头像
      state.avatarUrl = url;
    }
  },
  actions: {
  },
  modules: {
  }
})
